$(document).ready(function(e) {
	$('#bind').hide();
	$('#btnOK').click(function(e) {
		var txtMac=$('#txtMac').val();
		$.get('../../find.ashx',{mac:txtMac},function(data){
			if(data==-1)
			{
				alert('The MAC Address does not exist.');
			}
			else if(data==0)
			{
				alert('The MAC Address was already bound, please check it.');
			}
			else 
			{
				$('#xx').html(data);
				$('#bind').show();
			}
			});
    });
	
	$('#btnBind').click(function(e) {
		var txtBind=$('#txtBind').val();
		var txtMac=$('#txtMac').val();
		if(txtBind=='')
		{
			alert('Please enter your bound to the secondary domain name');
		}
		else 
		{
			$.get('../../find2.ashx',{txtBind:txtBind,mac:txtMac},function(data){
				if(data==-1)
				{
					alert('Bind failure');
				}
				else if(data==2)
				{
					alert('The domain name existed, please bind another one.');
				}
				else
				{
					alert('Bind Success');
				}
				});
		}
    });
});